/*
 * @(#)SessionEntity.java
 *
 * Copyright 2012 by ShenY BIS, All rights reserved.
 */

package com.bis.common.entity;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import com.bis.framework.entity.UserEntity;

/**
 * SessionEntity
 * 
 * @author BIS 2012-12-24
 */
public class SessionEntity implements java.io.Serializable, HttpSessionBindingListener, HttpSessionListener
{

    /**
     * Version Id
     */
    private static final long      serialVersionUID    = 1L;

    /**
     * userEntity
     */
    private UserEntity             userEntity          = null;

    /**
     * lstPermission
     */
    private List<PermissionEntity> lstPermission       = null;

    /**
     * welcomeUrl
     */
    private String                 welcomeUrl          = null;

    /**
     * welDate
     */
    private String                 welDate             = null;

    /**
     * strPermission
     */
    private String                 strPermission       = null;

    /**
     * mpcontion
     */
    private Map<String, String>    mpcontion           = new HashMap<String, String>();

    /**
     * strParentPermission
     */
    private String                 strParentPermission = null;

    /**
     * Session Create
     */
    public void valueBound(HttpSessionBindingEvent e)
    {
        //        LogUtil.insertUserOnline(userEntity);
    }

    /**
     * Session Delete
     */
    public void valueUnbound(HttpSessionBindingEvent e)
    {
        //LogUtil.deleteUserOnline(userEntity);
    }

    /**
     * sessionCreated
     */
    public void sessionCreated(HttpSessionEvent arg0)
    {

    }

    /**
     * sessionDestroyed
     */
    public void sessionDestroyed(HttpSessionEvent arg0)
    {
        //LogUtil.deleteUserOnline(userEntity);
    }

    /**
     * addMenu
     * @Description:
     * @param key
     * @param value
     */
    public void addMenu(String key, String value)
    {
        mpcontion.put(key, value);
    }

    /**
     * 取得Session信息。
     * @Description:
     * @param key
     * @return
     */
    public String getMpcontion(String key)
    {
        return mpcontion.get(key).toString();
    }
    
    /**
     * @return the userEntity
     */
    public UserEntity getUserEntity()
    {
        return userEntity;
    }

    /**
     * @param userEntity the userEntity to set
     */
    public void setUserEntity(UserEntity userEntity)
    {
        this.userEntity = userEntity;
    }

    /**
     * @return the lstPermission
     */
    public List<PermissionEntity> getLstPermission()
    {
        return lstPermission;
    }

    /**
     * @param lstPermission the lstPermission to set
     */
    public void setLstPermission(List<PermissionEntity> lstPermission)
    {
        this.lstPermission = lstPermission;
    }

    /**
     * @return the welcomeUrl
     */
    public String getWelcomeUrl()
    {
        return welcomeUrl;
    }

    /**
     * @param welcomeUrl the welcomeUrl to set
     */
    public void setWelcomeUrl(String welcomeUrl)
    {
        this.welcomeUrl = welcomeUrl;
    }

    /**
     * @return the welDate
     */
    public String getWelDate()
    {
        return welDate;
    }

    /**
     * @param welDate the welDate to set
     */
    public void setWelDate(String welDate)
    {
        this.welDate = welDate;
    }

    /**
     * @return the strPermission
     */
    public String getStrPermission()
    {
        return strPermission;
    }

    /**
     * @param strPermission the strPermission to set
     */
    public void setStrPermission(String strPermission)
    {
        this.strPermission = strPermission;
    }

    /**
     * @return the mpcontion
     */
    public Map<String, String> getMpcontion()
    {
        return mpcontion;
    }

    /**
     * @param mpcontion the mpcontion to set
     */
    public void setMpcontion(Map<String, String> mpcontion)
    {
        this.mpcontion = mpcontion;
    }

    /**
     * @return the strParentPermission
     */
    public String getStrParentPermission()
    {
        return strParentPermission;
    }

    /**
     * @param strParentPermission the strParentPermission to set
     */
    public void setStrParentPermission(String strParentPermission)
    {
        this.strParentPermission = strParentPermission;
    }

}
